import Vue from "vue";


function create(Comp, data) {
    const vm = new Vue({
        render: h => {
            return h(Comp, data)
        }
    }).$mount();
    document.body.append(vm.$el)
    const comp = vm.$children[0];

    comp.remove = () => {
        document.body.removeChild(vm.$el);
        vm.$destroy();
    }
    return comp;
}

export default create;